package net.esj.auth.inst.hibernate.dependent.background;

import org.springframework.beans.factory.annotation.Autowired;

import net.esj.auth.Constants;
import net.esj.background.manage.LoginManage;
import net.esj.background.support.UserInfoAware;
import net.esj.basic.core.engine.config.Configuration;
import net.esj.basic.view.BaseAction;

public class UserInfoAction extends BaseAction implements UserInfoAware, Constants{
	
	private Configuration configuration;

	private LoginManage loginManage;
	
	public String include(){
		return SUCCESS;
	}

	public Object getUserInfo() {
		return loginManage.getUserInfo();
	}

	@Autowired
	public void setLoginManage(LoginManage loginManage) {
		this.loginManage = loginManage;
	}
	
	public void setConfiguration(Configuration configuration) {
		this.configuration = configuration;
	}

	@Override
	public String getUsername() {
		return loginManage.getUsername();
	}
	
	public String getTemplate(){
		return configuration.getProperty(MELON_AUTH_TEMPLATE_KEY, DEFAULT_MELON_AUTH_TEMPLATE);
	}
	
}
